package com.example.compreshensiveshop.service.imp;

import com.example.compreshensiveshop.dao.ItemDao;
import com.example.compreshensiveshop.po.ItemPO;
import com.example.compreshensiveshop.service.ItemService;
import com.example.compreshensiveshop.vo.DailySalesVO;
import com.example.compreshensiveshop.vo.MonthlySalesVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Item Service Implementation
 */
@Service
public class ItemServiceImpl implements ItemService {
    @Autowired
    private ItemDao itemDao;

    @Override
    public void addItem(ItemPO itemPO) {
        itemDao.addItem(itemPO);
    }

    @Override
    public List<ItemPO> queryByOId(Long orderId) {
        return itemDao.queryByOId(orderId);
    }

    @Override
    public List<ItemPO> querySellerOrderFilter(Long sellerId, Integer status, String keyword, Integer itemStatus,int offset,int pageSize) {
        return itemDao.querySellerOrderFilter(sellerId,status,keyword,itemStatus, offset, pageSize);
    }

    @Override
    public void updateItemStatus(Long id,Integer  status) {
        itemDao.updateItemStatus(id, status);
    }

    @Override
    public List<ItemPO> querySellerSalesMoney(Long sellerId, Integer monthNum, Integer yearNum) {
        return itemDao.querySellerSalesMoney(sellerId,monthNum,yearNum);
    }

    @Override
    public List<DailySalesVO> queryDailySales(Long sellerId, Integer year, Integer month) {
        return itemDao.queryDailySales(sellerId,year,month);
    }

    @Override
    public List<MonthlySalesVO> queryMonthLySales(Long sellerId, Integer year) {
        return itemDao.queryMonthLySales(sellerId,year);
    }

    @Override
    public int countSellerOrderFilter(Long sellerId, Integer status, String keyword, Integer itemStatus) {
        return itemDao.countSellerOrderFilter(sellerId,status,keyword,itemStatus);
    }
}